
#include "my_time.h"
#include "stdlib.h"
#include <limits.h>
#include <math.h>

const size_t n = UINT_MAX;
inline double f(double x) { return 4.0 / (pow(x, 2.0) + 1.0); }
const double a = 0.0;
const double b = 1.0;
const double h = (double)(b - a) / (double)n;

int main() {
  MyTimeI;
  MyTimeA;

  double mypi = (f(a) + f(b)) / 2.0;
  // double mypi = (f(a) + f(b));
  for (size_t i = 1; i <= n; i++) {
    mypi += f(a + i * h);
  }
  mypi = h * mypi;

  MyTimeB;
  printf("mypi=%15.14g\n", mypi);
  return 0;
}